//
//  LIUAboutViewController.m
//  EasyNotes
//
//  Created by 劉裕 on 12/6/2016.
//  Copyright © 2016年 劉裕. All rights reserved.
//

#import "LIUAboutViewController.h"
#import <Masonry/Masonry.h>
@interface LIUAboutViewController ()

@property (nonatomic, weak) UIWebView *webView;
@end

@implementation LIUAboutViewController

#pragma mark - life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = NSLocalizedString(@"leftItem_Help", nil);
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"menu"] style:UIBarButtonItemStylePlain target:self action:@selector(menuBtnClick)];
    [self setupWebView];
    [self loadHtml];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

#pragma mark - Private Methods

- (void)loadHtml {
    NSURL *htmlUrl = [[NSBundle mainBundle] URLForResource:@"Markdown.html" withExtension:nil];
    NSURLRequest *requestUrl = [NSURLRequest requestWithURL:htmlUrl];
    [self.webView loadRequest:requestUrl];
}

- (void)setupWebView {
    WS(ws)
    UIWebView *webView = [UIWebView new];
    webView.backgroundColor = [UIColor whiteColor];
//    webView.scalesPageToFit = YES;
    [self.view addSubview:webView];
    self.webView = webView;
    
    [webView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.right.equalTo(ws.view).offset(0);
    }];
    
}

- (void)menuBtnClick {
    [self.navigationController popViewControllerAnimated:YES];
}

@end
